from django import newforms as forms

class CSVMapForm(forms.Form):
    """
    A form that performs the mapping of the fields of the CSV file uploaded 
    using ImportForm, to the fields of the DB
    """
    def __init__(self, headers, choices, *args, **kwargs):
        super(CSVMapForm, self).__init__(*args, **kwargs)
        for (field, value) in headers:
            self.fields['id_%s' % value] = forms.ChoiceField(label="'%s'" % field, required=True, choices=choices)            
